<template>
  <div class="boss">
    <head-page
      :title="`${this.$route.query.Headtitle}`"
      id="backstyle"
    ></head-page>
    <Banner :id="BannerID" class="bannerId"></Banner>
    <div class="text title-center tac l-h">
      {{ title }}
    </div>
    <div class="bottom m-t-0">
      <div class="area-center ">
        <div class="shenghui">
          <div
            class="small"
            v-for="(item, index) in address"
            :key="index"
            @click="provincial(item, ID, title, name)"
          >
            {{ item.provincial }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Notice } from "@/api/index";
import Banner from "@/components/Home/BannerView.vue";
export default {
  components: {
    Banner,
  },
  data() {
    return {
      address: [],
      ID: this.$route.query.id,
      title: this.$route.query.title,
      name: this.$route.query.top_title,
      BannerID: "",
    };
  },
  computed: {},
  //各省会发送请求的
  created() {
    Notice().then((res) => {
      this.address = res.data ? res.data.slice(0, res.data.length - 2) : "";
    });
    //判断轮播图的id
    if (this.$route.query.title == "全国各省名酒") {
      // 名酒
      this.BannerID = 10;
    } else if (this.$route.query.title == "全国各省名茶") {
      // 名茶
      this.BannerID = 7;
    } else if (this.$route.query.title == "全国各省项目") {
      // 大项目
      this.BannerID = 5;
    } else if (this.$route.query.title == "全国各省产品") {
      // 新产品
      this.BannerID = 6;
    } else if (this.$route.query.title == "全国各省商企") {
      // 商企库
      this.BannerID = 11;
    }
  },
  methods: {
    provincial(item, id, title, top_title) {
      if (this.$route.query.Headtitle == "大项目") {
        this.$router.push({
          path: "/largedetails",
          query: { citysub: item.provincial, id, title },
        });
      } else if (this.$route.query.Headtitle == "新产品") {
        this.$router.push({
          path: "/productlist",
          query: { citysub: item.provincial, id, title, top_title },
        });
      } else if (this.$route.query.title == "全国各省名茶") {
        this.$router.push({
          path: "/businesstwo",
          query: { citysub: item.provincial, id, title, city: item.provincial },
        });
      } else if (this.$route.query.title == "全国各省名酒") {
        this.$router.push({
          path: "/businesswine",
          query: { citysub: item.provincial, id, title, city: item.provincial },
        });
      } else {
        //商企库的标题
        this.$router.push({
          path: "/shangsix",
          query: { citysub: item.provincial, id, title },
        });
      }
    },
  },
};
</script>

<style scoped>
.boss {
  width: 100%;
  height: 6rem;
}
.text {
  width: 100%;

}
.bottom {
  width: 100%;
  min-height: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.2rem;
}

.bottom .center {
  height: 100%;
  margin-top: 0.05rem;
}
/* 省会区域 */
.shenghui {
  display: flex;
  flex-wrap: wrap;
}
.small {
  min-width: 0.5rem;
  height: 0.3rem;
  flex-shrink: 0;
  text-align: center;
  line-height: 0.3rem;
  margin: 0.04rem;
}
</style>